﻿<?php
/**
* @version              $Id: view.html.php 9764 2007-12-30 07:48:11Z ircmaxell $
* @package              Joomla
* @subpackage   Poll
* @copyright    Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved.
* @license              GNU/GPL, see LICENSE.php
* Joomla! is free software. This version may have been modified pursuant
* to the GNU General Public License, and as distributed it includes or
* is derivative of works licensed under the GNU General Public License or
* other free or open source software licenses.
* See COPYRIGHT.php for copyright notices and details.
*/

// Check to ensure this file is included in Joomla!
defined('_JEXEC') or die();

jimport( 'joomla.application.component.view');
               
class amapViewadherentsupprimerldb extends JView
{
        var $amap;
        function display($tpl = null)
        {
        $mainframe =& JFactory::getApplication();      
                if($this->amap->adLoggue)
                {
               
                        $document =& JFactory::getDocument();
                        $pathway  =& $mainframe->getPathway();

                        // Adds parameter handling
                        $params = $mainframe->getParams();

                        $params->def( 'show_page_title', 1 );
                        $params->def( 'page_title', 'adhésion');

                        if ($this->amap->adLoggue){
                                if ($this->amap->adExiste){

$query = "SELECT Nom,Prenom,IDJ,IDA FROM amap_adherent ORDER BY Nom ASC";
$database =& JFactory::getDBO();
$database->setQuery($query);
$database->query(); if ($database->getErrorNum()) {echo 'Error ' . $database->getErrorNum() . ': ' .$database->getErrorMsg();}
$liste=$database->loadRowList();
$idj=$_POST['idj'];
$idjj=$mainframe->GetUserState($option.'idjj');


echo "<FORM ACTION='/index.php/component/amap/?view=adherentsupprimerldb' method='post'>";
echo "<SELECT name='idj'   size='1'>";

foreach($liste as $value)
{
//echo "<INPUT name='toto' type='hidden' value=$value[2]>";
if($value[2] <> $idj){ echo "<OPTION  value='$value[2]'>$value[0]  $value[1]</OPTION>";}
if($value[2] == $idj) {echo "<OPTION  selected='selected' value='$value[2]' >$value[0]  $value[1]</OPTION>";
$mainframe->SetUserState($option."idjj", $idj);
}}
echo "</SELECT>";
//echo "<INPUT TYPE='hidden' name='idjj' value='$selected'>";
        echo "<INPUT TYPE='submit' value='valider la sélection'>";
//        echo "</FORM>";   
                              echo '</div>';
                                               

        //$idj=$_POST['idj'];
if($idj==NULL){$idj=0;}
        $query = "SELECT Nom,Prenom,IDJ,IDA FROM amap_adherent WHERE IDJ=$idj";
        $database =& JFactory::getDBO();
        $database->setQuery($query);
        $database->query(); if ($database->getErrorNum()) {echo 'Error ' . $database->getErrorNum() . ': ' .$database->getErrorMsg();}
        $adsuppr=$database->loadAssoc();
//              print_r($adsuppr);
$ida=$adsuppr['IDA'];
echo '<a href="./index.php?option=com_amap&amp;task=SuppressionAdherentldb&amp;ida='.$ida.'" >Une fois validée la sélection, cliquer sur cette ligne pour supprimer l\'adhérent <strong>'. $adsuppr['Nom'].' '.$adsuppr['Prenom'].'</strong></a>';

echo "</FORM>";
echo "<br><br><div>NB: L'utilisateur Joomla! ne sera pas supprimé</div>";

//Suppression_Adherentldb($ida);
                                        echo '<div id="amap_footer">
                                                </div>';

                                }
                               
                               
                        }
                }
parent::display($tpl);
        }
}
?>

